package controller

import (
	"gin_app01/model"
	"gin_app01/vo"
	"net/http"

	"github.com/gin-gonic/gin"
)

type LoginAndRegisterVO struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

// GetAll 获取所有
func GetAll(c *gin.Context) {
	u := new(model.SysUser)
	c.JSON(200, vo.ResponseOK(u.GetAll()))
}

// Post 添加用户
func Post(c *gin.Context) {
	var data model.SysUser
	if err := c.ShouldBind(&data); err != nil {
		c.JSON(http.StatusBadRequest, vo.ResponseException(400, "参数异常"))
		return
	}
	data.AddUser()
	c.JSON(http.StatusOK, vo.ResponseOK(data))
}
